SHELL = @SHELL@

srcdir          = @srcdir@
top_srcdir      = @top_srcdir@
prefix		= @prefix@
exec_prefix	= ${DESTDIR}/@exec_prefix@
bindir 		= @bindir@
datadir		= ${DESTDIR}/@datadir@/@PACKAGE@
INSTALL		= @INSTALL@
srcdir		= @srcdir@
pycomp		= @top_srcdir@/py-compile
CFLAGS          = -fPIC -shared -O @PYTHON_INCLUDES@

top_builddir = ..

PACKAGE = @PACKAGE@
VERSION = @VERSION@

bin_PROGRAMS = wajig

wajig_SOURCES = wajig.py documentation.py changes.py commands.py perform.py \
	        const.py.in bash_completion.py

gjig_SOURCES = gjig.py glutil.py

EXTRA_DIST =  gjig.glade jigsaw.png jigsaw-logo.png pieces.png

PROGRAMS =  $(bin_PROGRAMS)

COMPILE=${pycomp}

SUBDIRS =

DIST_COMMON =  Makefile.in

SOURCES = $(wajig_SOURCES) $(gjig_SOURCES)

DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

all:
	chmod +x ${pycomp}
	${pycomp} *.py

install:
	${INSTALL} -d ${datadir}
	${INSTALL} -m 644 *.py *.pyo *.glade *.png ${datadir}
	chmod +x $(datadir)/wajig.py $(datadir)/gjig.py

uninstall:
	rm -f ${datadir}/*.py ${datadir}/*.pyo ${datadir}/*.glade
	-rmdir ${datadir}

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = src

distdir: $(DISTFILES)
	here=`cd $(top_builddir) && pwd`; \
	distdir=`cd $(distdir) && pwd`; \
	for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  if test -d $$d/$$file; then \
	    cp -pr $$/$$file $(distdir)/$$file; \
	  else \
	    test -f $(distdir)/$$file \
	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
	    || cp -p $$d/$$file $(distdir)/$$file || :; \
	  fi; \
	done

clean:
	-rm -f core *.pyo *.pyc *.bak *~	

realclean: clean

cvsclean: realclean
	-rm -f *.pyc const.py Makefile
